﻿using System.Configuration;

namespace Tilver.Configuration.Data
{
    public class ConnectionStringElement : ConfigurationElement
    {
        /// <summary>
        /// 数据库连接定义名
        /// </summary>
        [ConfigurationProperty("name", IsKey = true, IsRequired = true)]
        public string Name
        {
            get { return this["name"] as string; }
            set { this["name"] = value; }
        }
        /// <summary>
        /// 数据库连接串
        /// </summary>
        [ConfigurationProperty("connectionString", IsRequired = true)]
        public string ConnectionString
        {
            get { return this["connectionString"] as string; }
            set { this["connectionString"] = value; }
        }
        /// <summary>
        /// 数据源提供者
        /// </summary>
        [ConfigurationProperty("providerName")]
        public string ProviderName
        {
            get { return this["providerName"] as string; }
            set { this["providerName"] = value; }
        }
        /// <summary>
        /// 是否加密
        /// </summary>
        [ConfigurationProperty("isEncrypted", DefaultValue = false)]
        public bool IsEncrypted
        {
            get { return (bool)this["isEncrypted"]; }
            set { this["isEncrypted"] = value; }
        }

    }
}
